{% extends "base.html" %}
{% load i18n  %}
{% block title %} {%trans 'Add Fields'%} {{sf_object.name}}{% endblock %}
{% block content-center%}
<div>{{view.name}}</div>
<form method="post">{%csrf_token%}
<table>
<th>
	<tr>
	<td>{%trans 'Delete'%}</td>
  <td>{%trans 'Name'%}</td>
  <td>{%trans 'Label'%}</td>
  <td>{%trans 'Order'%}</td>
  {%ifequal view.vtype 'multi'%}
  {%else%}
  <td>{%trans 'Group'%}</td>
  {%endifequal%}
  {%ifequal view.vtype 'form'%}
  <td>{%trans 'Required'%}</td>
  <td>{%trans 'Editable'%}</td>
  <td>{%trans 'Default Value'%}</td>
  {%endifequal%}
</tr>
</th>
{%for f in fields%}
<tr>
  <td><input name="{{f.id}}_delete" type="checkbox" /></td>
  <td>{{f.name}}</td>
  <td><input name="{{f.id}}_label" value="{{f.label}}" /></td>
  <td><input name="{{f.id}}_order" value="{{f.order}}" /></td>
	{%ifequal view.vtype 'multi'%}
	{%else%}
  <td><input name="{{f.id}}_group" value="{{f.group}}" /></td>
  {%endifequal%}
  {%ifequal view.vtype 'form'%}
  <td><input type="checkbox"  name="{{f.id}}_required" value="{{f.required}}" /></td>
  <td><input type="checkbox" name="{{f.id}}_editable" value="{{f.editable}}" /></td>
  <td><input name="{{f.id}}_def_val" value="{{f.def_val}}" /></td>
  {%endifequal%}
	
</tr>
{%endfor%}

{%for i in ef%}
<tr>
  <td><input name="new_{{i}}_delete" type="checkbox" /></td>
  <td>
  <select name="new_field_{{i}}">
  <option></option>
  {%for o in obj_fields%}
	<option value='{{o.pk}}'>{{o.name}}</option>
	{%endfor%}	
  </select>
	</td>
  <td><input name="new_label_{{i}}" value="" /></td>
  <td><input name="new_order_{{i}}" value="" /></td>
  {%ifequal view.vtype 'multi'%}
  {%else%}
  <td><input name="new_group_{{i}}" value="" /></td>
  {%endifequal%}
  {%ifequal view.vtype 'form'%}
  <td><input type="checkbox"  name="new_required_{{i}}" /></td>
  <td><input type="checkbox" name="new_editable_{{i}}" /></td>
  <td><input name="new_def_val_{{i}}" value="" /></td>
  {%endifequal%}
  
</tr>
{%endfor%}


</table>
<input type="submit" value="{%trans 'Save'%}" />
</form>

{% endblock content-center%}
